import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

export const constantRouterMap = [{
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    redirect: '/ticketing/ticket'
  },

  {
    path: '/ticketing',
    component: Layout,
    name: 'Ticketing',
    redirect: '/ticketing/ticket',
    meta: {
      title: '票务统计',
      icon: 'ticketing'
    },
    children: [{
        path: 'ticket',
        name: 'Ticket',
        component: () => import('@/views/ticketing/ticket/index'),
        meta: {
          title: '票种统计',
          icon: 'ticket'
        }
      },
      {
        path: 'channel',
        name: 'Channel',
        component: () => import('@/views/ticketing/channel/index'),
        meta: {
          title: '渠道统计',
          icon: 'channel'
        }
      }
    ]
  },

  {
    path: '/personnel',
    component: Layout,
    name: 'Personnel',
    redirect: '/personnel/sign',
    meta: {
      title: '人员统计',
      icon: 'personnel'
    },
    children: [{
        path: 'sign',
        name: 'Sign',
        component: () => import('@/views/personnel/sign/index'),
        meta: {
          title: '报名人数',
          icon: 'sign'
        }
      },
      {
        path: 'sex',
        name: 'Sex',
        component: () => import('@/views/personnel/sex/index'),
        meta: {
          title: '性别分析',
          icon: 'sex'
        }
      },
      {
        path: 'age',
        name: 'Age',
        component: () => import('@/views/personnel/age/index'),
        meta: {
          title: '年龄分析',
          icon: 'age'
        }
      },
      {
        path: 'province',
        name: 'Province',
        component: () => import('@/views/personnel/province/index'),
        meta: {
          title: '省份分析',
          icon: 'province'
        }
      },
      {
        path: 'industry',
        name: 'Industry',
        component: () => import('@/views/personnel/industry/index'),
        meta: {
          title: '行业分析',
          icon: 'industry'
        }
      },
      {
        path: 'occupation',
        name: 'Occupation',
        component: () => import('@/views/personnel/occupation/index'),
        meta: {
          title: '职业分析',
          icon: 'occupation'
        }
      },
      {
        path: 'nationality',
        name: 'Nationality',
        component: () => import('@/views/personnel/nationality/index'),
        meta: {
          title: '国籍分析',
          icon: 'nationality'
        }
      },
      {
        path: 'scale',
        name: 'Scale',
        component: () => import('@/views/personnel/scale/index'),
        meta: {
          title: '公司规模',
          icon: 'scale'
        }
      },
      // { 就是票务统计总的渠道统计
      //   path: 'source',
      //   name: 'Source',
      //   component: () => import('@/views/personnel/source/index'),
      //   meta: {
      //     title: '门票来源',
      //     icon: 'source'
      //   }
      // },
      {
        path: 'abroad',
        name: 'Abroad',
        component: () => import('@/views/personnel/abroad/index'),
        meta: {
          title: '国内外分析',
          icon: 'abroad'
        }
      }
    ]
  },
  {
    path: '/activity',
    component: Layout,
    name: 'Activity',
    redirect: '/activity/summary',
    meta: {
      title: '活动统计',
      icon: 'activity'
    },
    children: [{
        path: 'summary',
        name: 'Summary',
        component: () => import('@/views/activity/summary/index'),
        meta: {
          title: '汇总数据',
          icon: 'summary'
        }
      },
      {
        path: 'species',
        name: 'Species',
        component: () => import('@/views/activity/species/index'),
        meta: {
          title: '票种分析',
          icon: 'species'
        }
      },
      {
        path: 'ditch',
        name: 'Ditch',
        component: () => import('@/views/activity/ditch/index'),
        meta: {
          title: '渠道分析',
          icon: 'ditch'
        }
      },
      {
        path: 'forum',
        name: 'Forum',
        component: () => import('@/views/activity/forum/index'),
        meta: {
          title: '分论坛',
          icon: 'forum'
        }
      }
    ]
  },

  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap
})
